import request from '@/utils/request'
import querystring from 'querystring'

/**
 * 分页查询保险列表
 * @param {*} form 
 * @param {*} pageSize 
 * @param {*} currentPage 
 */
export function dataList(form, pageSize, currentPage) {
  const data = {
    param: form,
    pageSize: pageSize,
    pageNo: currentPage
  }
  return request.post('/insuranceCompany/page',data)
}

/**
 * 新增保险
 */
 export function createInsuranceCompany(params) {
  return request.post('/insuranceCompany/save', params)
}

/**
 * 编辑保险
 */
 export function updateInsuranceCompany(params) {
  return request.put('/insuranceCompany/save', params)
}

/**
 * 删除保险
 */
 export function deleteInsuranceCompany(id) {
  return request.delete(`/insuranceCompany/${id}`)
}

/**
 * 根据根据公司类型获取对应的公司列表
 */
 export function getCompanyListByCompanyType(companyType) {
  return request.get(`/insuranceCompany/get/${companyType}`)
}

/**
 * 获取保险详情
 */
 export function getCompanyDetail(id) {
  return request.get(`/insuranceCompany/${id}`)
}


/**
 * 分页查询保险险种列表
 * @param {*} form 
 * @param {*} pageSize 
 * @param {*} currentPage 
 */
export function insuranceTypeList(form, pageSize, currentPage) {
  const data = {
    param: form,
    pageSize: pageSize,
    pageNo: currentPage
  }
  return request.post('/insuranceType/page',data)
}


/**
 * 新增保险险种
 */
 export function createInsuranceType(params) {
  return request.post('/insuranceType/save', params)
}

/**
 * 编辑保险险种
 */
 export function updateInsuranceType(params) {
  return request.put('/insuranceType/save', params)
}

/**
 * 删除保险险种
 */
 export function deleteInsuranceType(id) {
  return request.delete(`/insuranceType/${id}`)
}

/**
 * 保险状态更新
 */
 export function insuranceTypeStatus(id) {
  return request.get(`/insuranceType/status/${id}`)
}